package com.smartlbs.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.smartlbs.dto.PayLogDto;
import com.smartlbs.entity.PayLog;
import com.smartlbs.mapper.PayLogMapper;
import com.smartlbs.service.IPayLogService;
import com.smartlbs.util.StringUtil;

@Service("payLogService")
public class PayLogServiceImpl implements IPayLogService {

	@Autowired
	private PayLogMapper payLogMapper;
	
	@Override
	public PageInfo<PayLog> find(Integer pageNum, Integer pageSize,
			PayLogDto payLogDto) {
		//
		PageHelper.startPage(pageNum, pageSize);
		
		if(!StringUtil.containEmpty(payLogDto.getType())){
			payLogDto.setTypeSet(StringUtil.transferStr2Set(payLogDto.getType(), ","));
			payLogDto.setType(null);
		}
		//
		List<PayLog> payLogList = payLogMapper.find(payLogDto);
		
		PageInfo<PayLog> pageInfo = new PageInfo<PayLog>(payLogList);
		
		return pageInfo;
	}

}
